package rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.entitet;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@SuppressWarnings("serial")
@Entity
@Table(name = "parametri")
@NamedQueries({ @NamedQuery(name = "radniParametri", query = "select p from Parametri p where not exists (select p1 from Parametri p1 where p1.datum > p.datum)") })
public class Parametri implements Serializable {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "pa_id")
	private Integer id;

	@Column(name = "pa_a", nullable = false)
	private Float a;

	@Column(name = "pa_b", nullable = false)
	private Float b;

	@Column(name = "pa_c", nullable = false)
	private Float c;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "pa_datum", columnDefinition = "timestamp default current_timestamp on update current_timestamp", nullable = false)
	private Calendar datum;

	public Parametri() {
		super();
	}

	public Parametri(Float a, Float b, Float c) {
		super();
		this.a = a;
		this.b = b;
		this.c = c;
	}

	public Integer getId() {
		return id;
	}

	public Float getA() {
		return a;
	}

	public void setA(Float a) {
		this.a = a;
	}

	public Float getB() {
		return b;
	}

	public void setB(Float b) {
		this.b = b;
	}

	public Float getC() {
		return c;
	}

	public void setC(Float c) {
		this.c = c;
	}

	public Calendar getDatum() {
		return datum;
	}

	public void setDatum(Calendar datum) {
		this.datum = datum;
	}

	@Override
	public String toString() {
		return "Parametri [id=" + id + ", a=" + a + ", b=" + b + ", c=" + c
				+ ", datum=" + datum + "]";
	}

}
